#ifndef _SN_HANDLE_H_
#define _SN_HANDLE_H_

#define NVS_SN_NAMESPACE    "SN"
#define NVS_SN_KEY          "sn"
// #define NVS_SN_NAMESPACE  "DEV_SN"
// #define NVS_SN_KEY        "SN"
#define SN_LEN            8
#define MAC_LEN           6
#define SN_LEN_STR        2 * SN_LEN + 1    //sn字符串长度

#define CHECK_SUM_LEN   1
#define MAC_CMP_LEN     18

#define SN_REQUEST      "SN?\n"        //sn请求
#define SN_ACK          "SN"           //应答标志 
#define SN_OK           "SNOK"         //sn正确

#define MAC_REQ         "MAC?"          //mac请求，由烧录软件发送
#define MAC_RSP         "MAC "          //mac响应
#define MAC_RSP_OK      "MACOK "        //mac正确

#define SN_CLEAR        "SN CLEAR"      //清除sn
#define SN_LEN_ERR      "LEN ERROR\n"   //sn长度错误
#define SN_CHECK_ERR    "CHECK ERROR\n" //sn校验错误
#define SN_WRITE_FINISH "a=0\n"         //写入完成


extern EventGroupHandle_t SnEventGroup;
#define SN_OK_BIT        BIT0           
#define SN_EXIST_BIT     BIT1
#define SN_REQUEST_BIT   BIT2

void SnHandleTask(void *param);
uint8_t *GetSN(void);
uint8_t *GetMAC(void);
uint8_t *GetSNStr(void);
uint8_t *GetMACStr(void);
bool GetSNStatus(void);

#endif